<div class="form-group"  {guanlians}>
	<label class="col-xs-12 col-sm-3 col-md-2 right-label">{{check_show_lang('{title}')}}</label>
	<div class="col-xs-12 col-sm-8 col-lg-9" ng-init="checkarray({tovalue},'{name}')">
		<div class="input-group" ng-if="'{action}'!=''" style="max-width:100%;">
			<div class="overflow-h" style="background: #eee;height:36px;max-width:100%;">
			<span ng-repeat="item in {tovalue}.{name} track by $index" ng-if="$index<=8" class="overflow-h" style="display: inline-block;padding: 5px;max-width:100px">{{item.{option_title}}};</span>
			<span ng-if=" {tovalue}.{name}.length>8" class="overflow-h" style="display: inline-block;padding: 5px;max-width:100px">······</span>
			</div>
			<span class="input-group-btn" >
				<button class="btn btn-gray" type="button" ng-click="unitfunc.choose_many({tovalue},'{name}','{action}')"><i class="fa fa-external-link"></i>{choose_title}</button>
			</span>
		</div>
		<div class="input-group multi-img-details" ng-if="{tovalue}.{name}">
			<div class="multi-item" style="height:auto;" ng-repeat="item in {tovalue}.{name} track by $index">
				<img ng-if="item.{option_image}" ng-src="{{tomedia(item.{option_image}) || '../core/resource/images/nopic.jpg'}}" class="img-responsive img-thumbnail" style="width:100px;height:100px">
				<div ng-if="item.{option_title}" class="overflow-h" style="text-align:center;width:100px">{{item.{option_title}}}</div>
				<em class="close" title="删除" ng-click="{tovalue}.{name}.splice($index,1)">×</em>
			</div>
		</div>
		<div class="help-block">{help}</div>
	</div>
</div>
<script>
if(!scope.unitfunc.choose_many){
	scope.unitfunc.choose_many=function(tovalue,field,url){
		if(url.indexOf('/')<0){
			url='/'+url;
		}
		scope.modal_func(function(res){
			if(!Array.isArray(tovalue[field])){
				tovalue[field]=[];
				tovalue[field].push(res);
			}else{
				var has=false;
				tovalue[field].forEach(function(item){
					if(JSON.stringify(item)==JSON.stringify(res)){
						has=true;
					}
				});
				if(!has){
					tovalue[field].push(res);
				}
			}
		},'',url);
	}
}

</script>